package com.lee.message.core.mapper;

import com.lee.message.core.entity.TransMsgInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface TransMsgInfoMapper {

    /**
     * 提交事务消息记录
     * @param msgInfo
     * @return
     */
    @Insert({"<script>",
            "insert into trans_msg_info(msg_id,create_time) values(#{msgId},#{createTime})",
            "</script>"})
    int insert(TransMsgInfo msgInfo);

    /**
     * 查询是否已经提交事务
     * @param msgId
     * @return
     */
    @Select({"<script>",
        "select count(1) from trans_msg_info where msg_id = #{msgId}",
        "</script>"})
    int count(String msgId);

}